package main.java.com.example.crm.dao.daoImpl;

import main.java.com.example.crm.dao.IUserDAO;
import main.java.com.example.tools.DBUtils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class UserDAOImpl implements IUserDAO {
    @Override
    public boolean findByUsernamePassword(String username, String password) throws Exception{

        Connection conn= DBUtils.getConnection();

        Statement stmt=conn.createStatement();

        String sql="select * from user where username='"+username+"' and password="+password;
        System.out.println(sql);
        ResultSet rs = stmt.executeQuery(sql);

        // 遍历结果集，封装结果信息
        if (rs.next())
        {
            return true;

        }
        else
        {
            return false;
        }

    }
}
